<template>
  <view class="content">
    <!-- <view class="site-card"> -->
    <view class="site-card" v-for="item in site" @tap="toHandle(item)">
      <view class="site-information">
        <text>{{ item.siteName }}</text>
        <view class="location">
          <u-icon name="map"></u-icon>
          <text>{{ item.siteAddress }}</text>
        </view>
      </view>
      <image class="img" src="@/static/img/base/back.png" mode=""></image>
    </view>
  </view>
</template>

<script>
import { API } from "../../config/myApi.js";
export default {
  data() {
    return {
      site: [],
    };
  },
  onLoad() {
    this.getSite();
  },
  methods: {
    toHandle(item) {
      console.log(item);
      uni.navigateTo({
        url: `/pages/registered/registered?id=${item.id}&siteAddress=${item.siteAddress}&siteName=${item.siteName}`,
      });
    },
    //获取场地
    getSite() {
      const pram = {
        rows: 10,
        page: 1,
        status: 0,
      };
      API.getSiteList(pram).then((res) => {
        if (res.code) {
          if (res.code == 200) {
            console.log(res);
            this.site = res.result.rows;
          }
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  padding: 0rpx 30rpx;
  .site-card {
    background: #fff;
    padding: 44rpx 24rpx;
    border-radius: 14rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24rpx;
    .site-information {
      > text {
        font-size: 14px;
        font-weight: bold;
        color: #333333;
      }
      .location {
        display: flex;
        align-items: center;
        margin-top: 26rpx;
        .img {
          width: 19rpx;
          height: 23rpx;
        }
        > text {
          color: #999999;
          font-size: 12px;
          margin-left: 4rpx;
        }
      }
    }
    .img {
      width: 18rpx;
      height: 31rpx;
      transform: rotate(180deg);
    }
  }
}
</style>